<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<h1>时钟</h1>
<div id="date">
</div>
<script>
  setInterval(showTime, 1000);
  function showTime() {
    let time = new Date();
     document.getElementById("date").innerText = time.toLocaleTimeString();
  }
</script>
</body>
</html>